import asyncio

from grpclib.client import Channel

from grpclib_test.proto.hello_grpc import GreeterStub
from grpclib_test.proto.hello_pb2 import HelloRequest


async def main():
    async with Channel('127.0.0.1', 50051) as channel:
        greeter = GreeterStub(channel)
        reply = await greeter.SayHello(HelloRequest(name='Dr. OldSix'))
        print(reply.message)


if __name__ == '__main__':
    asyncio.run(main())
